<template>
    <div>
        <cu-navbar>
            <block slot="content">佣金</block>
        </cu-navbar>
        <div class="page dhc-page">
            <div class="card btn-radius">
                <div  class="name">
                    <span >佣金</span>
                    <span >{{ userInfo.yjlj || 0}}</span>
                </div>
                <div  class="operation" @click="zhuanzeng">
                    <button  class="btn"> 核销 </button>
                </div>
            </div>
            <div class="title">明细</div>
        
            <div class="list">
                <div class="item f-r a-c j-b" v-for="item in list">
                    <div class="date">{{ item.create_time }}</div>
                    <div class="value f-g">{{ item.change_money}}</div>
                </div>
            </div>
        
            <footer-page
                :page="page"
                :pagesize="pagesize"
                :page-size="pageSize"
                :page-total="pageTotal"
                @pre="pagePre"
                @next="pageNext"
            ></footer-page>
        </div>
    </div>

</template>

<script>
import footerPage from "@/components/footer-page/index.vue";
import page from '@/mixins/page'
export default {
    components: {
        footerPage,
    },
    mixins: [page],
    data() {
        return {
            userInfo: {},
            list: [],
        }
    },
    onPullDownRefresh() {
        this.page = 1
        this.getList()
    },
    onShow() {
        this.userInfo = uni.getStorageSync('userinfo')
        this.getList()
    },
  methods: {
      getList() {
          this.$api.yongjin_list(2,this.page,  this.pagesize).then(res => {
              this.list = res.result.items
              this.pageTotal = res.result.pageTotal
              this.pageSize = res.result.pageSize || 0
          }).finally(() => {
              uni.stopPullDownRefresh()
          })
      },
    zhuanzeng() {
      uni.navigateTo({
        url: '/pages/user-yue/hexiao'
      })
    }
  }
}
</script>

<style lang="scss">
.dhc-page {
  padding: 20px;
  .title {
    font-size: 16px;
    color: #4a4a4a;
    margin: 20px 0;
  }
  .list {
    border-radius: 4px;
    background-color: #ffffff;
    padding: 10px;
    .item {
      font-size: 14px;
      color: #4a4a4a;
      border-bottom: 1px solid #eeeeee;
        padding: 10px 0;
      .value {
        margin: 0 20px;
      }
    }
  }
  .btn-radius {
    width: 100%;
    height: 100px;
    background: linear-gradient(180deg,#f3eae4,#f4d05e);
    opacity: 1;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-radius: 4px;

    .name {
      font-size: 20px;
      color: #836533;
    }
    .btn {
      width: 70px;
      height: 30px;
      line-height: 30px;
      border: 1px solid #836533;
      font-size: 14px;
      color: #836533;
      margin-left: 14px;
      background-color: transparent;
      white-space: nowrap;
      border-radius: 4px;
    }
  }
}
</style>
